package siruna.WE.DeviceDependent;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import siruna.WE.core.Constants.Functional;
import siruna.WE.core.Constants.Visual;
import siruna.WE.core.events.EventListener;
import siruna.WE.core.model.EventHandler;
import siruna.WE.core.model.EventList;
import siruna.WE.core.model.FunctionalBlock;
import siruna.WE.core.model.VisualBlock;
import siruna.WE.core.model.VisualBlocks.ButtonImpl;
import siruna.WE.core.model.VisualBlocks.ImageImpl;
import siruna.WE.core.model.VisualBlocks.LabelImpl;
import siruna.WE.core.model.container.ContentImpl;
import siruna.WE.core.model.container.PageImpl;

public class DeviceFunctionalBlockFactory {

	private WidgetEngine1 widgetEngine1;

	public DeviceFunctionalBlockFactory(WidgetEngine1 widgetEngine1) {
		this.widgetEngine1 = widgetEngine1;
	}

	public FunctionalBlock createDeviceFunctionalBlock(FunctionalBlock fb) {

		DeviceFunctionalBlock f = null;

		//eindigt reeds op Impl
		
		String name = fb.getClass().getSimpleName();
		name = name.substring(0, name.indexOf("Impl"));
		
		
		Class calc;
		try {
			calc = Class
					.forName("siruna.WE.DeviceDependent.AndroidFunctionBlocks."
							+ name + "Impl");
			f = (DeviceFunctionalBlock) calc.newInstance();
			f.setContext(widgetEngine1);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return f;

	}

}
